<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Browse_all extends MX_Controller {


	function __construct()
	{
		parent::__construct();
		
		$this->load->model('category/category_model');
		$this->load->model('location/location_model');
		$this->load->model('listing/listing_model');
		$this->load->model('listing/browse_model');
		$this->load->library('pagination');
	}
	
	function alphabetically($alpha="All")
	{
		$seg_cat = $this->uri->segment(3);
		
		
		$per_page = 10;
		$offset = 0;
		if($this->uri->segment(4)){
			$offset = $this->uri->segment(4);
		}
		if($alpha == 'All'){
				
			$data['browse'] = $this->browse_model->getAll($featured=0,$alpha='All',$per_page,$offset);
		
		
		}
		else{
		
			$seg_cat = $this->uri->segment(3);
		
		
			$offset = 0 + $this->uri->segment(4);
		
			$perpage = 10;
		
			$config['per_page'] = $perpage;
			$config['uri_segment'] = '4';
		
		
			$config['total_rows'] = $this->browse_model->count_all_business('profile');
			$config['base_url'] = base_url() . 'listing/alphabetically/' . $seg_cat;
		
			$cur =base_url()."listing/alphabetically/' . $seg_cat";
			$cur = '<a href="'. $cur   .'">&laquo; First</a>';
			$config['full_tag_open'] = '<ul class="pagination">';
			$config['full_tag_close'] = '</ul><!--pagination-->';
			$config['first_link'] = '&laquo; First';
			$config['first_tag_open'] = '<li class="prev page" style="display:inline">';
			$config['first_tag_close'] = '</li>';
			$config['last_link'] = 'Last &raquo;';
			$config['last_tag_open'] = '<li class="next page" style="display:inline">';
			$config['last_tag_close'] = '</li>';
			$config['next_link'] = 'Next &rarr;';
			$config['next_tag_open'] = '<li class="next page" style="display:inline">';
			$config['next_tag_close'] = '</li>';
			$config['prev_link'] = '&larr; Previous';
			$config['prev_tag_open'] = '<li class="prev page" style="display:inline">';
			$config['prev_tag_close'] = '</li>';
			$config['cur_tag_open'] = '<li class="active"><a href="">';
			$config['cur_tag_close'] = '</a></li>';
			$config['num_tag_open'] = '<li class="page">';
			$config['num_tag_close'] = '</li>';
			$config['display_pages'] = FALSE;
			
			$this->pagination->initialize($config);
			$data['browse'] = $this->browse_model->getAll($featured=0,$alpha=$alpha,$per_page,$offset);
		
		
		
		}
		
		
			$data['site_title'] = $this->settings_model->siteInfo('web_title');
			$data['canonical'] = base_url();
			$this->template->title($data['site_title']);
			$this->template->set_metadata('keywords', $this->settings_model->siteInfo('keyword'));
			$this->template->set_metadata('description', $this->settings_model->siteInfo('description'));
		
		
			$this->template->set_layout('browse_all');
			$this->template->set_partial('nav_bar','header/nav_bar');
			$this->template->set_partial('browse_all', 'modules/browse_all');
			$this->template->build('browse_lawyer',$data);
		}
	
	
}